﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace G.WeiBo.WebAPI
{
    public static class APIConfig
    {

        internal const string PostContentType = "application/x-www-form-urlencoded";

        internal const string PostMultiPartContentType = "multipart/form-data; boundary={0}";

        internal const string RetrieveRequestTokenPattern = "^oauth_token=(.+?)&oauth_token_secret=(.+?)$";

        internal const string RetrieveAccessTokenPattern = "^oauth_token=(.+?)&oauth_token_secret=(.+?)(&user_id=(.+?)){0,1}(&screen_name=(.+?)){0,1}$";

        internal const string RetrieveAuthorizationCodePattern = "<oauth_verifier>(.+?)</oauth_verifier>";

        public const string AppName = "sina";
        //public static string AppKey = "1029251523";
        public const string BaseUrl = "https://api.weibo.com/2";
        //public static string AppSecret = "5725cf318a29181031193bc168aa7c8e";

        //private static string _token;
        //private static string _tokenSecret;

        //public static string Token
        //{
        //    get
        //    {
        //        if (_token != null)
        //            return _token;
        //        if (System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Contains("Token"))
        //        {
        //            _token = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings["Token"] as string;
        //        }
        //        return _token;
        //    }
        //    set
        //    {
        //        _token = value;
        //    }
        //}
        //public static string TokenSecret
        //{
        //    get
        //    {
        //        if (_tokenSecret != null)
        //            return _tokenSecret;
        //        if (System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Contains("TokenSecret"))
        //        {
        //            _tokenSecret = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings["TokenSecret"] as string;
        //        }
        //        return _tokenSecret;
        //    }
        //    set
        //    {
        //        _tokenSecret = value;

        //    }
        //}

        //private static string oauth_verifier = string.Empty;
        //public static string Verifier
        //{

        //    get
        //    {
        //        if (oauth_verifier != string.Empty)
        //            return oauth_verifier;
        //        if (System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Contains("Verifier"))
        //        {
        //            oauth_verifier = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings["Verifier"] as string;
        //        }
        //        return oauth_verifier;
        //    }
        //    set
        //    {
        //        oauth_verifier = value;

        //    }
        //}

        public static bool IsLoadPic { get; set; }

        //public static void Save()
        //{
        //    System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings["TokenSecret"] = TokenSecret;
        //    System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings["Token"] = Token;
        //    System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings["Verifier"] = Verifier;
        //    System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings.Save();
        //}
    }
}
